"""Definition of the Desenvolvimento content type
"""

from zope.app.component.hooks import getSite
from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import folder
from Products.ATContentTypes.content import schemata

from AccessControl import ClassSecurityInfo

from cintra.types.content import cintrauser
from cintra.types.interfaces import IDesenvolvimento
from cintra.types.config import PROJECTNAME
from cintra.types.content.schemas.desenvolvimento import DesenvolvimentoSchema

from cintra.policy.utils.roles import DESENVOLVIMENTO_GROUP


class Desenvolvimento(cintrauser.CINTRAUser):
    """ Desenvolvimento type for Cintra website"""
    implements(IDesenvolvimento)

    meta_type = "Desenvolvimento"
    schema = DesenvolvimentoSchema
    
    security = ClassSecurityInfo()    
    
    def getGroup(self):
        return DESENVOLVIMENTO_GROUP    

    def get_home_url(self):
        portal = getSite()
        return portal.absolute_url_path() + '/view'


    def at_post_create_script(self):
        cintrauser.CINTRAUser.at_post_create_script(self)
#        self.setSignPassword('senha1') 


atapi.registerType(Desenvolvimento, PROJECTNAME)
